home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 4_0 / DONALDXC / GETFILEN.C < prev    next >
C/C++ Source or Header  |  1990-05-01  |  2KB  |  68 lines

  1. /********************************/
  2. /* File: GetFileNameToSave.c    */
  3. /*                                */
  4. /* Using Standard File Package    */
  5. /* query the user for the name    */
  6. /* of a file to open, and return*/
  7. /* the name along with the         */
  8. /* working directory id of the    */
  9. /* file.                        */
  10. /*                                */
  11. /* Paramters:                    */
  12. /* requires no input parameters    */
  13. /* ----------------------------    */
  14. /* To Build:                    */
  15. /*                                 */
  16. /* (1) Create a project using    */
  17. /* this file as well as the     */
  18. /* XCMD.Glue.c file. (Set         */
  19. /* project type to     XCMD (or    */
  20. /* XFCN) from the Project menu.    */
  21. /*                                */
  22. /* (2) Bring the project up to    */
  23. /* date.                        */
  24. /*                                */
  25. /* (3) Build Code Resource.     */
  26. /*                                */
  27. /* (4) Use ResEdit to copy the     */
  28. /* resource to your stack.        */
  29. /********************************/
  30.  
  31. #include    <MacTypes.h>
  32. #include    <OSUtil.h>
  33. #include    <MemoryMgr.h>
  34. #include    <FileMgr.h>
  35. #include    <ResourceMgr.h>
  36. #include    <pascal.h>
  37. #include    <string.h>
  38. #include     "HyperXCmd.h"
  39. #include    "HyperUtils.h"
  40.  
  41. pascal void main( paramPtr )
  42.     XCmdBlockPtr    paramPtr;
  43. {
  44.     short        FileWDID;
  45.     long        temp;
  46.     char        FileName[256];
  47.     char        WDIDString[32];
  48.     char        comma[2];
  49.         
  50.     *FileName = '\0';
  51.     Concat( (char *)FileName, "\pUntitled" );
  52.     
  53.     if( GetFileNameToSave( "", FileName, &FileWDID ) ){
  54.         temp = (long)FileWDID & 0xFFFF;
  55.         NumToStr( paramPtr, temp, &WDIDString );
  56.         PtoCstr( WDIDString );
  57.         
  58.         comma[0] = ',';        /* for you MPW folk */
  59.         comma[1] = '\0';
  60.         
  61.         strcat( FileName, comma );
  62.         strcat( FileName, WDIDString );
  63.         CtoPstr( FileName );
  64.     }
  65.     paramPtr->returnValue = PasToZero( paramPtr, FileName );
  66. }
  67.  
  68.